<template>
	<div>
		<view class="form_list">
			<view class="label">基本数量</view>
			<view class="input4">
				<input type="number" v-model="real_quantity" disabled />
			</view>
		</view>
		<view class="form_list">
			<view class="label">常用数量</view>
			<view class="input5 ">
				<uni-easyinput trim="all" type="number" :value="real_store_quantity" :inputBorder="false" @change="inputQty" @focus="toFocus"  ></uni-easyinput> <!-- @blur="toBlur" -->
			</view>
		</view>
	</div>
</template>

<script>
	import {
	  uniEasyinput
	} from "@dcloudio/uni-ui"
	export default {
		props: {
			real_quantity: {
			    type: Number,
			    default: 0
			},
			real_store_quantity: {
			    type: String,
			    default: '0'
			},
			coefficient:{
				type:Number,
				default:1
			},
			disabled:{
				type:Boolean,
				default:false
			}
		},
		data() {
		  return {
			  placeholderStyle:'font-size:27px;',
			}
		},
		components: {
			uniEasyinput
		},
		mounted(){
		},
		methods: {
			inputQty(val){
				//格式化数量,小数点后x位
				if(val == ''){
					this.$emit('update:real_store_quantity','0')
					this.$emit('update:real_quantity',0)
				}else{
					let real_quantity = this.$Func.decimalPattern(Number(val)*this.coefficient)
					this.$emit('update:real_quantity',real_quantity)
				}
			},
			toFocus(){
				if(this.real_store_quantity == '0'){ 
					this.$emit('update:real_store_quantity','')
				}
			},
			// toBlur(){
			// 	if(this.real_store_quantity == ''){
			// 		this.$emit('update:real_store_quantity','0')
			// 	}
			// }
		}
	}
</script>
<style >
</style>